import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 跑数记录信息 */
export interface Running {
          id: number; // 编号
          fileName?: string; // 文件名称
          totalNumberCount?: number; // 号码总数量
          currentNumberCount?: number; // 当前号码数量
          productConfigStr: string; // 产品配置字符串
          productConfig2: string; // 产品配置2
          taskStatus?: string; // 任务状态
          startTime: string | Dayjs; // 开始时间
          finishTime: string | Dayjs; // 完成时间
  }

// 跑数记录 API
export const RunningApi = {
  // 查询跑数记录分页
  getRunningPage: async (params: any) => {
    return await request.get({ url: `/system/running/page`, params })
  },

  // 查询跑数记录详情
  getRunning: async (id: number) => {
    return await request.get({ url: `/system/running/get?id=` + id })
  },

  // 新增跑数记录
  createRunning: async (data: Running) => {
    return await request.post({ url: `/system/running/create`, data })
  },

  // 修改跑数记录
  updateRunning: async (data: Running) => {
    return await request.put({ url: `/system/running/update`, data })
  },

  // 删除跑数记录
  deleteRunning: async (id: number) => {
    return await request.delete({ url: `/system/running/delete?id=` + id })
  },

  /** 批量删除跑数记录 */
  deleteRunningList: async (ids: number[]) => {
    return await request.delete({ url: `/system/running/delete-list?ids=${ids.join(',')}` })
  },

  // 导出跑数记录 Excel
  exportRunning: async (params) => {
    return await request.download({ url: `/system/running/export-excel`, params })
  }
}